package com.littleHan.brushQuestions.configs;

import com.littleHan.brushQuestions.web.specificTopic.service.SpecificTopicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * 定期更新点赞表，将redis中的点赞信息持久化到mysql中
 */
@Component
public class AppScheduledTasks {

    @Autowired
    SpecificTopicService specificTopicService;

    /*@Scheduled(cron = "0 0 2 * * *") //每天2点执行一次
    public void commentLikeUpdate() {

    }*/

    /**
     * 测试阶段每过10秒更新一次点赞
     */
    @Scheduled(cron = "*/10 * * * * *")//每隔十秒执行一次
    //@Scheduled(cron = "0 0 * * * * ") //每个整点执行一次
    public void commentLikeUpdate() {
        specificTopicService.updateCommentLike();
    }
}
